public class demo10 {
    public static void main(String[] args) {
        System.out.println(city.BEIJING.code);
        System.out.println(city.BEIJING.name);
        System.out.println(city.SHANGHAI.code);
        System.out.println(city.SHANGHAI.name);
    }
}
enum city{
    SHANGHAI("上海",1001),BEIJING("北京",1002);
    public String name;
    public int code;
    city(String name,int code){
      this.code=code;
      this.name=name;
    }

}